package com.zmx.patients.adapter;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.bumptech.glide.Glide;
import com.wang.adapters.adapter.BaseAdapterRvList;
import com.wang.adapters.base.BaseViewHolder;
import com.zmx.patients.R;
import com.zmx.patients.pojo.MallGoods;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * 程序猿：胖胖祥
 * 时 间：2020/12/18  19:18
 * 功 能：
 */
public class MallGoodsAdapter extends BaseAdapterRvList<MallGoodsAdapter.ViewHolder, MallGoods> {

    public MallGoodsAdapter(Activity activity) {
        super(activity);
    }

    @Override
    protected void onBindVH(ViewHolder holder, int listPosition, MallGoods mallGoods) {

        Glide.with(mActivity).load(mallGoods.getImg()).into(holder.goods_image);
        holder.goods_price.setText(mallGoods.getPrice()+"");
        holder.goods_name.setText(mallGoods.getName());

    }

    @NonNull
    @Override
    protected ViewHolder onCreateVH(ViewGroup parent, LayoutInflater inflater) {

        MallGoodsAdapter.ViewHolder holder = new MallGoodsAdapter.ViewHolder(inflater.inflate(R.layout.adapter_mall_goods, parent, false));
        return holder;
    }

    static class ViewHolder extends BaseViewHolder {

        @BindView(R.id.goods_price)
        TextView goods_price;
        @BindView(R.id.goods_name)
        TextView goods_name;
        @BindView(R.id.goods_image)
        ImageView goods_image;

        ViewHolder(View view) {
            super(view);
            ButterKnife.bind(this, view);
        }

    }

}
